#include <QApplication>
#include <QQmlApplicationEngine>
#include <logfile.h>
#include <QtQml>
#include "qmlobjecttest.h"
#include "qdebug2logcat.h"
#include "mycommon.h"
#include <QDebug>
#include <QAndroidJniEnvironment>
#include <QAndroidJniObject>


int main(int argc, char *argv[])
{

#ifdef ANDROID
    installLogcatMessageHandler("yourLogTag");
#else

    //打开日志文件，以文本写入方式
    logFile::g_log_fp = fopen("my.log", "wt");
    //程序退出时关闭日志文件
    atexit(logFile::closeLogFile);

    //使用我的日志类处理qt日志
    qInstallMessageHandler(logFile::myMessageOutput);

#endif

    QApplication app(argc, argv);

    qmlRegisterType<qmlObjectTest>("QmlObjectTest", 1, 0, "QmlObjectTest");
    qmlRegisterType<MyCommon>("MyCommon", 1, 0, "MyCommon");

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    return app.exec();
}

